import { registerApplication, start } from "single-spa";

registerApplication(
  { // 注册应用
    name: "@single-spa/welcome",// 应用名字
    app: () =>
      System.import(
        "https://unpkg.com/single-spa-welcome/dist/single-spa-welcome.js"
      ),
    activeWhen: location => location.pathname == '/',
  }
);
registerApplication(
  { // 注册应用
    name: "@l/vue-app",// 应用名字
    app: () =>
      System.import('@l/vue-app'),
    activeWhen: ["/vue"], // 访问vue路径的时候，加载System.import('@l/vue-app')
    customProps: { a: 1 } // 参数传递
  }
);

registerApplication(
  { // 注册应用
    name: "@l/react",// 应用名字
    app: () =>
      System.import('@l/react'),
    activeWhen: ["/react"], // 访问react路径的时候，加载System.import('@l/react')
    customProps: { a: 1 } // 参数传递
  }
);

// registerApplication({
//   name: "@n/navbar",
//   app: () => System.import("@n/navbar"),
//   activeWhen: ["/"]
// });

start({ // 启动路径
  urlRerouteOnly: true,
});
